<!--
* @description 驳回原因弹窗
* @fileName examPrj.vue
* @author zero_fsc
* @date 2020/05/22 04:26:13
!-->
<template>
  <YlForm
    ref="ylform"
    :formConfig="formConfig"
    @init-state="getInitState"
  />
</template>

<script>
export default {
  props: {
    rejectData: {
      type: Object,
      default: () => ({})
    }
  },
  data () {
    return {
      formConfig: {
        addApi: '',
        btnMethod: ['submit'],
        formData: {
          reason: ''
        },
        editRules: {
          reason: [
            { required: true, message: '请输入驳回原因', trigger: 'blur' }
          ]
        },
        columns: [
          {
            type: 'textarea',
            label: '驳回原因',
            prop: 'reason',
            labelWidth: 24
          }
        ]
      }
    }
  },
  mounted () {
    this.initFormData()
  },
  methods: {
    initFormData () {
      this.formConfig.addApi = this.rejectData.api
      Object.assign(this.formConfig.formData, this.rejectData)
      delete this.formConfig.formData.api
    },

    getInitState (val) {
      this.$emit('init-state', val)
    }
  }
}
</script>
